from bottle import static_file,route, run,template,get, post, request ,response

def check_login(username,password):
    if(username!="" and password!= ""):
        return 1
    else :
        return 0

def loginDeal():
    username = request.forms.get('username')
    password = request.forms.get('password')
    if check_login(username, password):
        response.set_cookie("account", username, secret='some-secret-key')
        return template("base",text="Welcome %s! You are now logged in."%username,lineNum=1)
    else:
        return template("base",text="Login failed.",lineNum=1)